<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="/node_modules/layui/dist/css/layui.css">
</head>

<body>
    <h2>点击下方按钮开始获取基金信息</h2>
    <button type="button" class="layui-btn" onclick="getFundInfo()">开始爬取</button>
    <table id="demo" lay-filter="test"></table>
</body>
<script src="/node_modules/layui/dist/layui.js"></script>
<script src="/node_modules/jquery/dist/jquery.min.js"></script>
<script>
    function getFundInfo() {
        layui.use('table', function () {
            var table = layui.table;
            //第一个实例
            table.render({
                elem: '#demo',
                height: 312,
                url: 'http://127.0.0.1:3000/getFundInfo',
                page: true,
                cols: [[ //表头
                    { field: 'title', title: '基金名称', },
                    { field: 'fundgz', title: '是否涨跌', },
                    { field: 'fund_gszf', title: '涨跌幅', sort: true },
                ]]
            });
        });
    }
</script>

</html>